//
//  ViewController.m
//  arcgis test
//
//  Created by 李林 on 16/4/12.
//  Copyright © 2016年 李林. All rights reserved.
//

#import "ViewController.h"

#import <ArcGIS/ArcGIS.h>

@interface ViewController ()<AGSMapViewLayerDelegate>

@property (weak, nonatomic) IBOutlet AGSMapView *mapView;

@end

@implementation ViewController

// 隐藏顶部状态栏
- (BOOL)prefersStatusBarHidden
{
    return YES;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // 设置ClientID（去除地图上的水印）
    [AGSRuntimeEnvironment setClientID:@"L8zvYbPtXBtrHJ26" error:nil];
    
    //加载瓦片图层
    NSString *urlstr = @"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
    
    NSURL *mapURL    = [NSURL URLWithString:urlstr];
    
    AGSTiledMapServiceLayer *tiledLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:mapURL];
    [self.mapView addMapLayer:tiledLayer];
    
    // 设置代理
    self.mapView.layerDelegate = self;
}

- (void)mapViewDidLoad:(AGSMapView *)mapView{
    NSLog(@"%@",@"地图加载成功!");
    // 显示当前你所在的位置坐标
    [mapView.locationDisplay startDataSource];
}

- (void)viewDidUnload{
    self.mapView =nil;
}





@end
